#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>

#define N 401

using namespace std;

int f[N][N];
bool vis[N][N];
// direction
const int dx[] = {-1, -2, -2, -1, 1, 2, 2, 1};
const int dy[] = {2, 1, -1, -2, 2, 1, -1, -2};
//
int n, m, x, y;

void bfs(int x, int y){
	memset(f, -1, sizeof(f));	memset(vis, false, sizeof(vis));
	queue< pair<int, int> > Q;
	f[x][y] = 0; vis[x][y] = true; Q.push(make_pair(x, y));
	int xx, yy;		int u, v;
	while(!Q.empty()){
		xx = Q.front().first;	yy = Q.front().second;	Q.pop();
		for(int i = 0; i < 8; i++){
			u = xx + dx[i];	v = yy + dy[i];
			if(u < 1 || u > n || v < 1 || v > m || vis[u][v])	continue;
			vis[u][v] = true;	Q.push(make_pair(u, v));	f[u][v] = f[xx][yy] + 1;
		}
	}
}

int main(){
	//freopen("demo.txt", "w", stdout);
	scanf("%d%d%d%d", &n, &m, &x, &y);
	bfs(x, y);
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			printf("%-5d", f[i][j]);
		}
		printf("\n");
	}
	return 0;
}